﻿Imports FL_8x0.Common
Imports FL_8x0.Viewmodel

Namespace FL_8x0.View

    Public Class MainWindow
        Public Sub New()
            InitializeComponent()
            Dim strCode As String = GetSetting("FL-830", "activation", "activation-code", "12345")

            Dim sn As String = GetMd5(GetMd5(MacUtil.GetId()))
            Debug.Print(sn)
            If strCode <> Common.SystemData.SN And strCode <> sn Then
                If Not New ActivationWindow().ShowDialog() Then
                    Me.Close()
                End If
            End If
            If Not New LoginWindow().ShowDialog() Then
                Me.Close()
            End If

            DataContext = New MainViewModel

            AddHandler MouseDown, Sub(sender, e)
                If e.LeftButton = MouseButtonState.Pressed Then
                    Me.DragMove()
                End If
            End Sub
        End Sub


        Public Shared Sub LogOut()
            If Not New LoginWindow().ShowDialog() Then
                Application.Current.Shutdown()
            End If
            Application.Current.MainWindow.Show()
        End Sub

    End Class
End NameSpace